import 'package:flustars/flustars.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:tracker/startup/config/model/global_config_resp.dart';

class GlobalConfigNotifier extends StateNotifier<GlobalConfigData> {
  GlobalConfigNotifier()
      : super(SpUtil.getObject('globalConfig') == null
            ? GlobalConfigData()
            : GlobalConfigData().fromJson(SpUtil.getObject('globalConfig')!));

  void setGlobalConfig(GlobalConfigData globalConfig) {
    state = globalConfig;
    SpUtil.putObject('globalConfig', globalConfig);
  }
}
